export default function debounce(func, duration = 100) {
    let timer = null;
    return (...params) => {
        return new Promise(resolve=>{
            clearTimeout(timer);
            timer = setTimeout(() => {
                resolve(func.apply(this, params));
            }, duration);
        })
    }
}